#include<iostream>
#include<string>
#include<memory>
//简单工厂模式

class Fruit
{
public:
    virtual void name() = 0;
};

enum class FruitType
{
    APPLE = 1,
    BINANA = 2
};
class Apple : public Fruit 
{
public:
    void name()override 
    {
        std::cout<<"苹果!"<<std::endl;
    }
};

class Binana :public Fruit
{
    void name()override 
    {
        std::cout<<"香蕉!"<<std::endl;
    }
};

class Factory
{
public:
    virtual std::shared_ptr<Fruit> create() = 0;
};

class AppleFactory : public Factory
{
public:
    std::shared_ptr<Fruit> create() override 
    {
        return std::make_shared<Apple>();
    }
};
int main()
{
    AppleFactory a;
    auto res = a.create();
    res->name();
    return 0;
}
